/*
*
*   Custom JavaScript
*   Product: KnowledgeBase WordPress Theme
*
* */


$("#bcheckzb").click(function(){
	var b = $(this).prop("checked");
	var inputvalue = $("#s").val();
	if(b){
		$("#s").val("110.2806,40.1537;111.2144,41.0875");
	}else{
		$("#s").val("K52E007011");
	}
});

var dizhidiaochaurl ="http://localhost:6080/arcgis/rest/services/1x5dizhi/1x5quyudizhidiaocha/MapServer";
var xianlayerurl ="http://localhost:6080/arcgis/rest/services/xianchina/MapServer/0";
var xiansymbol;
// Show Coord 
function showCoordinates(evt) { 
	dojo.byId("info").innerHTML = "当前坐标：" + evt.mapPoint.x.toFixed(3) + ", " + evt.mapPoint.y.toFixed(3); 
} 
var map, navToolbar, counties, queryTask, query, symbol, evt0,toolbar;

	function executeQueryTask(evt) { 
		query.geometry = pointToExtent(map, evt.mapPoint, 0); 
		evt0 = evt; 
		queryTask.execute(query, showResults); 
		} 
	function showResults(featureSet) { 
		map.graphics.clear(); 
		var resultFeatures = featureSet.features; 
		var graphic = resultFeatures[0]; 
		var name = graphic.attributes["图幅编号"];
		if(resultFeatures.length>0){
			queryByName(name);
		}else{
			
		}
	} 
	
	
	function activateToolbar(){
        toolbar.activate(esri.toolbars.Draw.EXTENT);
      }
	
 function queryByName(name){
    map.graphics.clear();
	var queryTask1 = new esri.tasks.QueryTask(dizhidiaochaurl+"/0"); 
	var query = new esri.tasks.Query(); 
	query.returnGeometry = true; 
	query.outFields = ["图幅名称","图幅编号","承担单位"]; 
    query.where = "图幅编号 = '"+name+"'";
	queryTask1.execute(query,function(featureSet){
		map.graphics.clear(); 
		var resultFeatures = featureSet.features; 
		
		if(resultFeatures.length>0){
			
		
		
			var graphic = resultFeatures[0]; 
			graphic.setSymbol(symbol); 
			map.graphics.add(graphic); 
			var centerpoint = new esri.geometry.Polygon(graphic.geometry).getCentroid();
			//在地调局档案库中搜索该文件资料名称，如果有标志出来档案编号和所属单位
			$.ajax({
				cache:false,
				type: "get",
				data:{"name":name},
				url: "http://localhost:8080/ddproject/servlet/checkDangan",
				contentType:"application/json",
				beforeSend: function(XMLHttpRequest){ 
					XMLHttpRequest.setRequestHeader("contentType", "application/x-www-form-urlencoded; charset=UTF-8"); 
					
					},
				success: function (msg) {
					var trstr = "";
					
					for(var i=0,len=msg.length;i<len;i++){
						var item = msg[i];
						trstr+="<tr><td><b>电子档号: </b>"+item.dabh+"</td></tr><tr><td><b>档案名称: </b>"+item.damc+"</td></tr>";
					}
					$("#tb1").html(trstr);
					$("#datalist").show();
					var itemdetail ="";
					if(msg.length>0){
						itemdetail +="<b>全国地质资料馆档号: </b>"+item.dabh+"<br /><b>档案名称: </b>"+item.damc+"<br />";
					}else{
						
						itemdetail +="<b>完成单位: </b>"+graphic.attributes["承担单位"]+"<br />";
					}
					
					
					var id = graphic.attributes["图幅编号"]; 
					map.infoWindow.setTitle("<b>查询结果: </b>"); 
						var nContent = "<b>图幅名称: </b>" + graphic.attributes["图幅名称"] + "<br />" 
						+ "<b>图幅编号: </b>" + id + "<br/>"+itemdetail; 
					//map.setExtent(graphic.geometry.getExtent());
					map.centerAndZoom(centerpoint,8);
					map.infoWindow.setContent(nContent); 
					map.infoWindow.show(centerpoint); 
					
					
				},
				error: function (e) {
					alert("error");
				}
			});
		
		}else{
			alert("没有相关记录");
			map.infoWindow.hide();
		}
	
	});
	
	
   };
	
	
	 function queryXianByEnvelope(query){
	    map.graphics.clear();
		var queryTask1 = new esri.tasks.QueryTask(xianlayerurl); 
		query.returnGeometry = true; 
		queryTask1.execute(query,function(featureSet){
			map.graphics.clear(); 
			var features = featureSet.features;
			if(features.length>0){
				
			
			var strname = new Array();
			for(var i in features){
				var resultFeatures = features[i]; 
				var graphic = resultFeatures; 
				graphic.setSymbol(xiansymbol); 
				map.graphics.add(graphic); 
				strname.push(graphic.attributes["NAME2004"]);
			  }
	
			$.ajax({
					cache:false,
					type: "get",
					data:{"name":strname.toString()},
					url: "http://localhost:8080/ddproject/servlet/getInfoByName",
					contentType:"application/json",
					beforeSend: function(XMLHttpRequest){ 
						XMLHttpRequest.setRequestHeader("contentType", "application/x-www-form-urlencoded; charset=UTF-8"); 
						},
					success: function (msg) {
						var trstr = "";
						for(var i=0,len=msg.length>8?8:msg.length;i<len;i++){
							var item = msg[i];
							trstr+="<tr><td><b>电子档号: </b>"+item.dabh+"</td></tr><tr><td><b>档案名称: </b>"+item.damc+"</td></tr>";
						}
						$("#tb1").html(trstr);
						$("#datalist").show();
					},
					error: function (e) {
						alert("error");
					}
				});
			
			}else{
				alert("没有相关记录");
			} 
		  
		  /*
		var centerpoint = new esri.geometry.Polygon(graphic.geometry).getCentroid();
		
		var id = graphic.attributes["ID"]; 
		map.infoWindow.setTitle("<b>查询结果: </b>"); 
			var nContent = "<b>报告名称：</b>"
			+ "<b>电子档号: </b>" + graphic.attributes["name"] + "<br />" 
			+ "<b>唯一标识符: </b>" + id + "<br/>"; 
		//map.setExtent(graphic.geometry.getExtent());
		map.centerAndZoom(centerpoint,10)
		map.infoWindow.setContent(nContent); 
		map.infoWindow.show(centerpoint); 
		*/
	});
   };
	
	
	function pointToExtent(map, point, toleranceInPixel) { 
		var pixelWidth = map.extent.getWidth() / map.width; 
		var toleraceInMapCoords = toleranceInPixel * pixelWidth; 
		return new esri.geometry.Extent(point.x - toleraceInMapCoords, 
		point.y - toleraceInMapCoords, 
		point.x + toleraceInMapCoords, 
		point.y + toleraceInMapCoords, 
		map.spatialReference); 
	} 

//init esrimap tools
function initmap(){
	dojo.require("dijit.layout.BorderContainer"); 
	dojo.require("dijit.layout.ContentPane"); 
	dojo.require("esri.map"); 
	dojo.require("esri.layers.FeatureLayer"); 
	dojo.require("esri.toolbars.navigation"); 
	dojo.require("esri.layers.ArcGISDynamicMapServiceLayer"); 
	dojo.require("esri.layers.ImageParameters"); 
	dojo.require("dijit.Toolbar"); 
	dojo.require("esri.dijit.Scalebar");
	dojo.require("esri.geometry");
	dojo.require("esri.geometry.Polygon"); 
	dojo.require("esri.geometry.Point"); 
	dojo.require("esri.toolbars.draw");
	dojo.require("dijit.TitlePane");
	dojo.require("dijit.layout.BorderContainer");
      dojo.require("dijit.layout.ContentPane");
	(function init() { 
	symbol = new esri.symbol.SimpleFillSymbol(esri.symbol.SimpleFillSymbol.STYLE_SOLID, 
					new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID, 
					new dojo.Color([255, 255, 255, 0.35]), 1), new dojo.Color([255, 0, 0, 0.35]));
	xiansymbol = new esri.symbol.SimpleFillSymbol(esri.symbol.SimpleFillSymbol.STYLE_SOLID,
					new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID, 
					new dojo.Color([10,200,0, 0.75]), 1), new dojo.Color([74,176,206, 0.35]));
	
	map = new esri.Map("map", { 
		center: [107, 36], 
		zoom: 3 
	}); 

	dojo.connect(map, "onLoad", function () {
			
			toolbar = new esri.toolbars.Draw(map);
			$("#drawtools").click(function(){
				toolbar.activate(esri.toolbars.Draw.EXTENT);
			})
          dojo.connect(toolbar,"onDrawEnd",drawEndHandler);
			
		dojo.connect(map, "onMouseMove", showCoordinates); 
		dojo.connect(map, "onMouseDrag", showCoordinates); 
	}); 
	
      function drawEndHandler(geometry){
        toolbar.deactivate();
        map.graphics.clear();

        //select the points within the extent
        var query = new esri.tasks.Query();
        query.geometry = geometry;
		query.spatialRelationship = esri.tasks.Query.SPATIAL_REL_INTERSECTS;
        queryXianByEnvelope(query);
      }
	//天地图 
	dojo.declare("TianDiTiledMapServiceLayer", esri.layers.TiledMapServiceLayer, { 
	constructor: function () { 
	this.spatialReference = new esri.SpatialReference({ wkid: 4326 }); 
	this.initialExtent = (this.fullExtent = 
	new esri.geometry.Extent(-180.0, -90.0, 180.0, 90.0, this.spatialReference)); 
	this.tileInfo = new esri.layers.TileInfo({ 
	"rows": 256, 
	"cols": 256, 
	"compressionQuality": 0, 
	"origin": { "x": -180, "y": 90 }, 
	"spatialReference": { "wkid": 4326 }, 
	"lods": [ 
	{ "level": 0, "resolution": 0.703125, "scale": 295497593.05875 }, 
	{ "level": 1, "resolution": 0.3515625, "scale": 147748796.529375 }, 
	{ "level": 2, "resolution": 0.17578125, "scale": 73874398.264688 }, 
	{ "level": 3, "resolution": 0.087890625, "scale": 36937199.132344 }, 
	{ "level": 4, "resolution": 0.0439453125, "scale": 18468599.566172 }, 
	{ "level": 5, "resolution": 0.02197265625, "scale": 9234299.783086 }, 
	{ "level": 6, "resolution": 0.010986328125, "scale": 4617149.891543 }, 
	{ "level": 7, "resolution": 0.0054931640625, "scale": 2308574.945771 }, 
	{ "level": 8, "resolution": 0.00274658203125, "scale": 1154287.472886 }, 
	{ "level": 9, "resolution": 0.001373291015625, "scale": 577143.736443 }, 
	{ "level": 10, "resolution": 0.0006866455078125, "scale": 288571.86822143558 }, 
	{ "level": 11, "resolution": 0.00034332275390625, "scale": 144285.93411071779 }, 
	{ "level": 12, "resolution": 0.000171661376953125, "scale": 72142.967055358895 }, 
	{ "level": 13, "resolution": 8.58306884765625e-005, "scale": 36071.483527679447 }, 
	{ "level": 14, "resolution": 4.291534423828125e-005, "scale": 18035.741763839724 }, 
	{ "level": 15, "resolution": 2.1457672119140625e-005, "scale": 9017.8708819198619 }, 
	{ "level": 16, "resolution": 1.0728836059570313e-005, "scale": 4508.9354409599309 }, 
	{ "level": 17, "resolution": 5.3644180297851563e-006, "scale": 2254.4677204799655}] 
	}); 
	this.loaded = true; 
	this.onLoad(this); 
	}, 
	getTileUrl: function (level, row, col) { 
		var levelMap = ""; 
		if (level < 10) { 
		levelMap = "A0512_EMap"; 
		} else if (level < 12) { 
		levelMap = "B0627_EMap1112"; 
		} else if (level < 18) { 
		levelMap = "siwei0608"; 
		} 
		return "http://t1.tianditu.cn/DataServer?T=vec_c&" + levelMap + "&X=" + col + "&Y=" + row + "&L=" + (level * 1 + 1); 
	} 
	}); 

	//文字标注 
	dojo.declare("TianDiBiaoZhuMapServiceLayer", TianDiTiledMapServiceLayer, { 
	getTileUrl: function (level, row, col) { 
	return "http://t1.tianditu.cn/DataServer?T=cva_c&X=" + col + "&Y=" + row + "&L=" + (level * 1 + 1); 
	} 
	}); 

	//影像地图 
	dojo.declare("TianDiYXMapServiceLayer", TianDiTiledMapServiceLayer, { 
	getTileUrl: function (level, row, col) {//wmts 
	return "http://t1.tianditu.cn/DataServer?T=img_c&X=" + col + "&Y=" + row + "&L=" + (level * 1 + 1); 
	} 
	}); 
	
	

	//ArcGIS 地图 
	dojo.declare("ArcGISMapServiceLayer", TianDiTiledMapServiceLayer, { 
	getTileUrl: function (level, row, col) {//wmts 
	return "http://219.142.81.85/arcgis/rest/services/5wanKD/MapServer/WMTS/tile/1.0.0/5wanKD/default/default028mm/" + level + "/" + row + "/" + col + ".png"; 
	} 
	}); 

	map.addLayer(new TianDiTiledMapServiceLayer()); 
	var arcGISLayer = new ArcGISMapServiceLayer(); 
	arcGISLayer.setOpacity(0.3); 
	//map.addLayer(arcGISLayer); 
	
	//加载私有数据

	var layer = new esri.layers.ArcGISDynamicMapServiceLayer(dizhidiaochaurl);
    layer.opacity = 0.5;
	$("#qydzdcbtn").click(function(){
		map.addLayer(layer);
	});
	
	map.addLayer(new TianDiBiaoZhuMapServiceLayer()); 
	

	//点击地图查询
	//add the street trees to the map 
	dojo.connect(map, "onClick", executeQueryTask); 
	queryTask = new esri.tasks.QueryTask(dizhidiaochaurl+"/0"); 
	query = new esri.tasks.Query(); 
	query.returnGeometry = true; 
	query.outFields = ["图幅名称","图幅编号","承担单位"]; 

	dojo.connect(map, "onUpdateEnd", function () { esri.hide(dojo.byId("status")); }); 
	dojo.connect(map, "onLoad", function () { 
		dojo.connect(map, "onMouseMove", showCoordinates); 
		dojo.connect(map, "onMouseDrag", showCoordinates); 
	}); 
	
	})();
}



jQuery(document).ready(function(e) {

	$ = jQuery;
	initmap();
	/*
    // 百度地图API功能
    var map = new BMap.Map("map");    // 创建Map实例
    map.centerAndZoom(new BMap.Point(116.404, 39.915), 11);  // 初始化地图,设置中心点坐标和地图级别
    map.addControl(new BMap.MapTypeControl());   //添加地图类型控件
    map.setCurrentCity("北京");          // 设置地图显示的城市 此项是必须设置的
    map.enableScrollWheelZoom(true);     //开启鼠标滚轮缩放

	*/
    $("#datalistpanelhidebtn").click(function(){
        $("#datalist").toggle();
    })
    /*-----------------------------------------------------------------------------------*/
    /*	Menu Dropdown Control
     /*-----------------------------------------------------------------------------------*/
    $('.main-nav li').hover(function(){
        $(this).children('ul').stop(true, true).slideDown(500);
    },function(){
        $(this).children('ul').stop(true, true).slideUp(500);
    });

    $('.sub-menu li').click(function(){
        window.location = $(this).children('a').attr('href');
    });


    /*-----------------------------------------------------------------------------------*/
    /* CSS Fixes
    /*-----------------------------------------------------------------------------------*/
    //$(".flickr-photos > a:nth-child(3n+3) img").css("marginLeft","0px");



    /*-----------------------------------------------------------------------------------*/
    /* Apply Class on search form widget inputs
    /*-----------------------------------------------------------------------------------*/
    $("#searchform #s").addClass("span3 search-query");
    $("#searchform #searchsubmit").addClass("btn");



    /*-----------------------------------------------------------------------------------*/
    /*	Page's Nav
     /*-----------------------------------------------------------------------------------*/
    $(".pages-nav a").addClass("btn");



    /*-----------------------------------------------------------------------------------*/
    /*	Tags Cloud
    /*-----------------------------------------------------------------------------------*/
    $('.tagcloud a').removeAttr('style').addClass('btn btn-mini');

    /*-----------------------------------------------------------------------------------*/
	/* Pretty Photo Lightbox
	/*-----------------------------------------------------------------------------------*/
   if( jQuery().prettyPhoto )
    {
        $(".pretty-photo").prettyPhoto({
            deeplinking: false,
            social_tools: false
        });


        $('a[data-rel]').each(function() {
            $(this).attr('rel', $(this).data('rel'));
        });


        $("a[rel^='prettyPhoto']").prettyPhoto({
            deeplinking: false,
            social_tools: false
        });
    }




	/* ---------------------------------------------------- */
	/*	Accordion
	/* ---------------------------------------------------- */
    $(function() {
		$('.accordion dt').click(function(){
			$(this).siblings('dt').removeClass('current');
			$(this).addClass('current').next('dd').slideDown(500).siblings('dd').slideUp(500);
		});	
    });



	/* ---------------------------------------------------- */
	/*	Toggle
	/* ---------------------------------------------------- */
    $(function() {
		$('dl.toggle dt').click(function(){
			if($(this).hasClass('current')){
				$(this).removeClass('current').next('dd').slideUp(500);
			}				
			else{
				$(this).addClass('current').next('dd').slideDown(500);
			}
		});	 
    });



	/*-----------------------------------------------------------------------------------*/
	/*	Scroll to Top
	/*-----------------------------------------------------------------------------------*/	
    $(function() {
        $(window).scroll(function () {
            if(!$('body').hasClass('probably-mobile'))
            {
                if ($(this).scrollTop() > 50) {
                    $('a#scroll-top').fadeIn();
                } else {
                    $('a#scroll-top').fadeOut();
                }
            }
            else
            {
                $('a#scroll-top').fadeOut();
            }
        });

        $('a#scroll-top').on('click', function(){
            if(!$('body').hasClass('probably-mobile'))
            {
                $('html, body').animate({scrollTop:0}, 'slow' );
                return false;
            }
        });
    });



	/* ---------------------------------------------------- */
	/*	Tabs
	/* ---------------------------------------------------- */
    $(function(){

        var $tabsNav    = $('.tabs-nav'),
            $tabsNavLis = $tabsNav.children('li');

        $tabsNav.each(function(){
            var $this = $(this);
            $this.next().children('.tab-content').stop(true,true).hide()
                                                 .first().show();
            $this.children('li').first().addClass('active').stop(true,true).show();
        });

        $tabsNavLis.on('click', function(e) {
            var $this = $(this);
            $this.siblings().removeClass('active').end()
                 .addClass('active');
            var idx = $this.parent().children().index($this);
            $this.parent().next().children('.tab-content').stop(true,true).hide().eq(idx).fadeIn();
            e.preventDefault();
        });

    });



	 /* ---------------------------------------------------- */
	 /*  Responsive Tables by ZURB
	 /*	  Foundation v2.1.4 http://foundation.zurb.com
	 /* ---------------------------------------------------- */
	  var switched = false;
	  var updateTables = function() {
		if (($(window).width() < 767) && !switched ){
		  switched = true;
		  $("table.responsive").each(function(i, element) {
			splitTable($(element));
		  });
		  return true;
		}
		else if (switched && ($(window).width() > 767)) {
		  switched = false;
		  $("table.responsive").each(function(i, element) {
			unsplitTable($(element));
		  });
		}
	  };
	   
	  $(window).load(updateTables);
	  $(window).bind("resize", updateTables);
	   
		
		function splitTable(original)
		{
			original.wrap("<div class='table-wrapper' />");
			
			var copy = original.clone();
			copy.find("td:not(:first-child), th:not(:first-child)").css("display", "none");
			copy.removeClass("responsive");
			
			original.closest(".table-wrapper").append(copy);
			copy.wrap("<div class='pinned' />");
			original.wrap("<div class='scrollable' />");
		}
		
		function unsplitTable(original) {
            original.closest(".table-wrapper").find(".pinned").remove();
            original.unwrap();
            original.unwrap();
		}



    /* ---------------------------------------------------- */
    /*	Like Button JS
     /* ---------------------------------------------------- */
    $('#like-it-form .like-it').click(function(){
        var likeButton = $(this);
        var likeHtml = likeButton.html();
        var likeNum = parseInt(likeHtml, 10);
        likeNum++;
        likeButton.html(likeNum);

         //   $('#like-it-form').ajaxSubmit(options);
    });




    /*-----------------------------------------------------------------------------------*/
    /*	FAQs
    /*-----------------------------------------------------------------------------------*/
    $('.faq-item').not('.faq-item.active').find('.faq-answer').slideUp('slow');
    $('.faq-item').first().addClass('active').find('.faq-answer').slideDown('slow');

    $('.faq-question, .faq-icon').click(function(e){

        e.preventDefault();

        var $this = $(this);
        var $parent = $this.parent('.faq-item');

        if( $parent.hasClass('active') )
        {
            $parent.removeClass('active').find('.faq-answer').slideUp('slow');
        }
        else
        {
            $parent.addClass('active').find('.faq-answer').slideDown('slow');
        }

    });



    /*-----------------------------------------------------------------------------------*/
    /*	Contact Form 7
    /*-----------------------------------------------------------------------------------*/
    $('.wpcf7-textarea').addClass('span6');
    $('.wpcf7-submit').addClass('btn');


    /*-----------------------------------------------------------------------------------*/
    /*	Search Form Validation
     /*-----------------------------------------------------------------------------------*/
	 
	 $(".search-btn").click(function(){
		var inputvalue = $("#s").val();
		if(inputvalue){
			
			var b = $("#bcheckzb").prop("checked");
			var inputvalue = $("#s").val();
			if(b){
				//$("#s").val("110.2806,40.1537;111.2144,41.0875");
				var str = inputvalue.split(";");
				var lowstr = str[0].split(",");
				var hightstr = str[1].split(",");
				
				var singleRingPolygon = new esri.geometry.Polygon([[lowstr[0], lowstr[1]], [hightstr[0], hightstr[1]]]);
				
				var query = new esri.tasks.Query();
		        query.geometry = singleRingPolygon;
				query.spatialRelationship = esri.tasks.Query.SPATIAL_REL_INTERSECTS;
				queryXianByEnvelope(query);
			}else{
				queryByName(inputvalue);
			}
			
			
			
		}else{
			alert("输入值");
		}
		
	 });
    $('#search-form').validate({

        errorLabelContainer: $("#search-error-container"),
        submitHandler: function(form) {
                                       $("#datalist").toggle();
									   
                                        $(form).submit(function(e){
                                             
                                             $(form).ajaxSubmit(contact_options);
                                            e.preventDefault();
                                        })
                                        

                                }
    });
	
	
	/*-----------------------------------------------------------------------------------*/
                /*	Responsive Nav
                /*-----------------------------------------------------------------------------------*/
                var $mainNav    = $('.main-nav > div').children('ul');
                var optionsList = '<option value="" selected>Go to...</option>';

                $mainNav.find('li').each(function() {
                        var $this   = $(this),
                                $anchor = $this.children('a'),
                                depth   = $this.parents('ul').length - 1,
                                indent  = '';
                        if( depth ) {
                                while( depth > 0 ) {
                                        indent += ' - ';
                                        depth--;
                                }
                        }
                        optionsList += '<option value="' + $anchor.attr('href') + '">' + indent + ' ' + $anchor.text() + '</option>';
                }).end();

                $('.main-nav > div').after('<select class="responsive-nav">' + optionsList + '</select>');

                $('.responsive-nav').on('change', function() {
                        window.location = $(this).val();
                });

                /*----------------------------------------------------------------------------------*/
                /*	Contact Form AJAX validation and submition
                /*  Validation Plugin : http://bassistance.de/jquery-plugins/jquery-plugin-validation/
                /*	Form Ajax Plugin : http://www.malsup.com/jquery/form/
                /*---------------------------------------------------------------------------------- */
                if(jQuery().validate && jQuery().ajaxSubmit)
                {
                        // Contact Form Handling

                        var contact_options = {
                                target: '#message-sent',
                                beforeSubmit: function(){
                                        $('#contact-loader').fadeIn('fast');
                                        $('#message-sent').fadeOut('fast');
                                },
                                success: function(){

                                        $('#contact-loader').fadeOut('fast');
                                        $('#message-sent').fadeIn('fast');
                                        $('#contact-form').resetForm();
                                }
                        };


                }

                /*-----------------------------------------------------------------------------------*/
                /*	Live Search
                /*-----------------------------------------------------------------------------------*/
                if(jQuery().liveSearch){

                        jQuery('#s').liveSearch({url: 'search.php?livesearch=used&s='});
                }
				
});







